<template>
	<view class="content">
		<button type="default" @click="requestfn">发起请求</button>
	</view>
	<view class="content">
		<view v-for="todos in todoslist">
			{{todos.id}}
			{{todos.title}}
		</view>
	</view>
</template>

<script setup>
//import { ref } from "vue"	
const todoslist = ref([])
let i = 1
function requestfn(){
	uni.request({
		method:"GET",
		url:`https://jsonplaceholder.typicode.com/todos/${i}`,
		success: (res) => {
			console.log(res.data)
			todoslist.value.push(res.data)
			console.log(todoslist.value)
		}
	})
	i += 1
}

</script>

<style lang="scss">
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
</style>
